tmp is always = 3. Still didn't discover why