Fix uses of ulong where 32-bit integers are expected
Merge pull request #113 from TsudaKageyu/fix-ulong

Fix uses of ulong where 32-bit integers are expected