bugfix: core dump resulted from dereference NULL pointer