fix for issue #3090 and #3091 on master branch