Cleanup un-necessary global and decrease possible wait time on 'sleep' task (in case max_time fails)