fixed castling condition problem