Added some tests scripts and fixed minor bug.