moved the template ifdef in a more appropriate place