Changed a bit MySQL connection routine.