Fix issue 3851, 3849