Additional check for lifecycle events in runScript