working, there was a counter 1 off that gives a segfault (numbering for header)