fix source comparison problems for functions in package environments