Fixed possible problem with stale connections in MySQL