Merge pull request #1011 from c0nk/wip-implicit-cast-fix

Fix some narrowing implicit casts [NFC]