Bug fix in clock%tick()