FIX Wrong comparison in unregister function