Fixed scripts based on unit tests [fix1]