Get rid of a few explicit or unnecessary casts