Fix bugs introduced from previous commit.

Re-fix MySQL edge case checks.