Fixed a bug in profiling