fixed state changed detection in TaskTracker and added tests