Add grotty casts to prevent negative -> large positive conversion of cursor