bug fix for array