Fix toUint32

Fixes #1147