small refactor for DB allowing reconnections