Chagen scan cursor type to long as it should be an unsigned 64 bit number

Fixes #531