Fix error when no headers are sent