fix database leak