Fixing typecast error