bug fix (segmentation fault)