Fixing switch_context