handle errors, tests fix