fix issue of copyToArray() method and add one test for it