Fixed a bug when switching projects/modes