take export out of if block