eliminate ugly cast