fix loss detection