add assert to prevent abnormal input