What dynasty lasted until the 17th century BC