Improved error logging.
Fixed runtime memory corruption, and setting the source location of the function definition arguments.