cast to larger data type on 32bits, probably fixes #809