fix unit tests;
a few coverity defecects;
Merge remote-tracking branch 'origin/4.5.2' into 4.5.2