fixed loop issue