removed sum from cast function