minor refactorings
(cherry-picked from a685914)
fixed type in comment