Fix errors found with -Wconversion.