Fixed compiler warnings (mostly casting)