Fix autotest infinite loop