changed "buffer[80] to buffer[sizeof(buffer)-1]