Bugfixes to clock.