Converted most uses of long to int as the library expected a long to be 32-bits