Fixed up some types.

Some variables were larger then required size and others were signed when they should have been unsigned.