in progress...
fixed bug in addfun line