Fixed a bug with the context switching

The context switching wasn't really happening. Now the issue is fixed.