Fix issues in move generation