bug fixed, sort added