[valgrind] fix some found by valgrind