I found the MagiStone but unfortunately it didn't help for long. There might be some other things influencing the bug. Now I needed "-1 Magic Core".
This is only a guess but you should check the amount with "greater to" instead of "equal to"
e.g. like this ---> if (magiccore=>5)
NOT like this ---> if (magiccore==5)