Fix compiler warnings

Ok, here is the fun one! Passes systemcmds/tests after changes. I'll keep cranking away on the rest of them...