fixed some bugs after the reverts