Fix all cppcheck warnings (with exception of tests)
Replace dynamic casts
Merge remote-tracking branch 'github/master'