Fixed serialize for arrays