Fix branch bugs