Fix for when profiler is disabled, from github user yamkazu