Unit test improvements and a minor bug fix in the new profiler