Fix for database connection consumption bug #535