Fixes and tests
fixes