Fix undefined variable access when deactivating PS instances