fix some bugs from last commit