Clean up some compiler warnings, mostly to do with long/int signedness