Fix time bugs