Added support to set wether allow overwrite the existing ref.