Fixed compiler warnings

With default xcode settings I had a bunch of warnings. Most of them were due to necessary implicit narrowing conversions so I made them explicit.