fix some bugs relating to syncing.
clean up api settings