Change types and add casts where needed to avoid compiler errors