Add null check.
Refactor ManualSync class.
Merge remote-tracking branch 'upstream/master'