refactoring, fix script