Fixes #4948. Thanks, @johan162