fixing issue with array output