Reduced most calls to get_canonical_path to getcwd instead.
The fork() in get_canonical_path was interacting badly with gprof.