fix loop in associative array