changed casts from fixed to int