Revert "fixed some small bugs"

This reverts commit b32bc360dba91552862665b5162212e18d1597c0.
Revert "Revert "fixed some small bugs""

This reverts commit 47f9c7613d85e4c3136b5f83e586af5506212b7a.