Convert test mode switch into flag