fix bug: segment fault