Add partial support for valgrind