Fixed compiler warnings

They were basically all implicit conversions from long to int or similar.