Fixed bugs with branches