Fixing MySQL connections