fixes a bug when the branch is in the last of the file