add fundamental functions for afile
copy a patch from afile