fix for function definition overwrite bug