improve error handling, part 2