Fix various branching/JAL bugs