fix a possible bug and kill some unnecessary lines of code