fix some more problems found by static analysis