before castling