add is_reference handling to rebuildFunctions