Fixed error handeling in createTag
Updated error handeling in createBranch