fixed output array issue