reworked mysql connection