Changed some C style casts into C++ style casts
Fixed the fix for %ld vs %lld formatting
Merge branch 'master' into ser