Fix test running and improve Makefile