Fix branch name encoding issue (more robust)