fix sorted Array bug