changed cast function, ex11 finished