Fix a few bugs found thru warnings on newer compilers