fix naive date in middleware