fix case-sensitivity bug
optimize code