improve mode switch