refactored server-side device syncing code
It's still not great T_T
make sure Location isn't null