fixed a merging error from some clean up that happened since the original changes from Sunanda

This should be the same as #3776.  @bsunanda Can you have a look to see that this gets all of your changes?