corrected state change behaviour in scripts