fixed some bugs; added script for auto test
fixed some bugs; added script for auto test