Fixed a bug in the tick handling