Fix bugs in test spec