fix resource copying