implement proper check, close db clients