Fix potential thread race in online() callback, possibly fixing #168