Apply changes from alain91 for Issue #51
Apply changes from alain91 for Issue #52