improved the debug function to show calling function