moved script operation to right order