some fixes and cmp changes