Fixed database max connection problem