Add tests for uncovered code. Fixes #49