Fixes

Small fixes and tests, coverage is around 96%