Debugging num_peers()
Fix input handling race condition