implement sanity tests (fixes #231)