Fixed error handeling on createBranch