fixes strftime bug in query