logging improvements, database fixes, other minor fixes