modify profiling function