fix: api now removes previous instances from an agent when it is registered again