Fix issue with database reconnection causing program termination.