Incorporating dup_fix patch from pylibgal3