Fixed bugs found in first test case. Current test set is successfully done.