fix slight performance regression in for-in looping code