mysql refactor fix