Fixed Makefile to work more reliably