fix for #3090 and #3091