Fix narrowing conversion errors