Add some test scripts, fixed a bug