Fixed bugs in test