Fix bug in tick timer