fix some errors, found by analysers