fixes issue #2754 and #2742