Fixed early exit logic