Fix testing code and exception model.