Move endif; to the right place.