fixed branch undefined bug