Revert "fix few bugs"

This reverts commit ac51343f352783023d7758c76ca8b5ae4b778be2.