fix bug when processing invalid CURIs
minor changes