correctly handle all primitive arrays