fixed: invalid foreach