fixed bug with time() function