Fix bug in tick callback.