Consolidate timestamp override checks
Add some debugging
Fix SQL timestamp handling