Typecast to prevent errors. Fixes #3654