Fixed memory allocation in copy constructor