fixed issue of castling