fixed compilation errors in Linux

Couldn't compile code on Linux Ubuntu 10.04 without casting.
Seems to work fine on Windows.