work on #368 which also helps #367
tests for #368 (need #367 to work)