Fixing time handling to support local time properly