Remove some compiler warnings

I mostly added some type casts to stop compiler warnings. It doesn't change much, but having less noise when compiling the project is always good. :)

Also, this PR is part of the much larger PR I've sent (and closed) last week.