fixed bug with setting prev_time in monitor loop, still needs some work