Fixed profiling bugs