backport #526 to 7.0.x