fixes swwithcing problem