Fix compile errors
Fix building token header entry
Auth if sending for the firsst time
Fix dangerous buffer write