Fix Issue #2481

I apply the solutions that @kguelzau comment on the Issue #2481 description.