Fixed 'Entity is already tracked' errors.