Fix a few places where there were negative indices for the core ID.  Add default case for branch type.