fixed branching problem and added assembly code