fixed time bug in logic.php