Fixes tests/adds tests to cover new cases