Improved array clone; added tests for it