Fix custom invalid error message (also fixes 1.6 compatibility).
Merge pull request #15 from carljm/fix-invalid-error-message

Fix custom invalid error message (also fixes 1.6 compatibility).