Eliminate some redundant casts.