Added code to set lock position on mode change