change copy() function to synchronous function