Fix NullPointerException in Sync

- Edit loop for Sync thread
- Add conditionals to check flow of login