debug: invalid write of size 1 occurred