improve error reporting in sanity checks (#48)