fixed bug for passing ref array.