Added reconnection to mysql