add type asserts in appendBranch
remove redundant size parameter to appendBranch, rename type -> op