replace memcpy with struct assignment