add tags and fix error handling bug on scan