bugfix: make sure array is copied before call to callback