fixed missing endif statement