bug fixes and code revert.