MySQL bug correction

See commit description for details.