Defensive programming checks. Closes GH-16