Updated mysql handling