Fixes various casts
Merge pull request #70 from stanislasrybak/master

Fixes various casts