Fix bugs in coordinator.cpp