some reverts and bug fixes