check castling first