Loop problem solved