Segfaults after the 'Cannot modify header...' error