fix mode and script stuff