fixing some bugs in agree