Fix bugs in copyToArray. Make implementations private so they can't be pattern matched. Performance improvements in some implementations.