Fix for last commit and better handling on mode swap