Fix narrowing casts