merged #369
tests for #368