Optimized scripts for functional tests
Fixed issues with tests