fix infinite recursion in double mode