fix bug with where the independent array loop starts and stops