Migration of 'fix' to inner scope. Lifted from Lodash.