Fix "time" is not defined issue