removed extra endif to fix broken code