Loop bug fixed

Array problem fixed.