pull in stdlib.h for malloc/free and fixes for some warnings