Makefile fixes and raise RuntimeError if branch leaves cannot be found