Added two unit tests, fixed ut issues

Modified memtest.js, added struct-test.js, fixed many unit test issues.