Fixes and tests to verify behavior