Fixed bugs in move validation algorithms