fixed bug in datetime formatting