fix bug where min sql datetime was needed