removed temporary hack when generating function