squash really nasty npe
fix #797 by producing a nicer error message