function code gen running but bugs in variable references in body and call