Fix of Issue #528 , Added tests of the patch

These tests would fail without the patch