added protection against regex failures in beheading