compiler warnings

This commit fixes quite a few compiler warnings most of which were caused by implicit conversion of a 64 bit number to a 32 bit number.