Fix FATAL bug

NameError: name 'patches' is not defined LINE 319