FIX: problem with lines counter in for and if statements