Revert and fix some changes