Fix for Issue #257

with unit test