Fixed bug with double-application of localtime