fix and regression tests for github issue #1258

fix for #1258