fix bug ,and enhance performance