Make sure to reset the variables.
Improved specs for auto_detect.