Fixed an important bug in the error checking code (closes gh-8)

The bug has been introduced in previous release