Fix fromIntegral bugs