Fix bugs introduced from previous commit.

Re-fix MySQL edge case checks.
Merge pull request #547 from jdufresne/master

Fix bugs introduced from previous commit.