Fix crashes on start.
Fix bug in time shift calculation.