fix an ugly cast