Adding int cast for offsets

This should fix issue #117.