memory fixes (#19), build fixes in Makefile