added #include <stdlib.h> to get rid of errors building with gcc-4.4 on ubuntu