fixed more cast issues