added castling validation