revise tests & error handling