making some type casts abide by coding standard

A few PR's ago I introduced some incorrect type casts that were merged without being fixed.  I tried to track them (and others) down in this PR.