bug fixes for a negative objective value and computing tree agreement