Fix previous bugs, add support for failure