Fixed loop syntax issues.