Fixed missing endif statement