fix prompt and branch pattern recognition