Few minor issues highlighted by cppcheck/valgrind.
Merge branch 'master' into recast