Fixes for compile time errors on C++11

Most of the errors are implicit casting which are not allowed anymore.
honestly, both "before" and "after" versions look wrong to me  :-P