Fixing DB Frees

Fixing DB Frees and Logging