Fix undefined variable on restore and active plugin