code review fixes

Also noticed other locations with similar issues mentioned in code
review that were fixed.