Fix for issues #3931 and #3932