fix loop
minor fixes