Fixed issue with some variables not being set during mode change;