added database reconnection trying