protecting against undefined copy array