fixed a bug, in which the mysql connection would hang after a long period of inactivity