Added a safety check

Fixes #7.