Fix sort() crash bug catch exception of sort()