bug fix- detect in makearray function