Add missing unit/integration tests. Fix #1