fix scrutinizer issues (all solvable ;)

@seut I think these should all be reported as scrutinizer bugs, and not fixed in the codebase. It is perfectly ok to have a tool that reports false-positives, but fixing them is actually just worse :P