Common programming mistake using for()-loop