added "debug" flag for scripts