Fixed warnings and added stddef.h include so that it now compiles in gcc