Fixed all errors in existing testcases.  may need more testcases