[primitive arrays] fix bug in length check