introduced some variables
(cherry picked from commit df45b03)