use safer method of transfering array