Fixed a bug related to task switching.