fix scan crash bug