Fix for github issue #2161