Some minor fixes, adding sys/types.h might fix 64bit int issue on Mac OSX with old gcc versions.