Fixed issue with too many database connections