minor tweaks to tally code - mostly for gcc compat