Fixes and tests for #216