add Makefile
fix standard includes
don't overwrite buffer size on return