fix array copying primops and some test cases