Applied fix by CoDEmanX. Restored some previous enum comparisons, e.g. (active_obj.mode != 'EDIT') back to ('EDIT' not in active_obj.mode).