Replaced process.nextTick with setImmediate in profile.test