array loop correction