backport 0cf34d26804a17bb9173cde750f09078d13f6eaa to stable5