fix issue #2229 (cast and convert not working)

See #2229