time bugfixes and cleanup