small modification to avoif segmentation fault