Edge case fixes, correctly insert timestamp into databse

refs #7479