Fixes for tools/updateResCount.php

Sorry - I deleted the branch that I requested a pull from.  I'm still getting used to using git like this.  See the commit messages for more info on these changes.