Fix assert() vs fail() bug and patch up test.