replace Thread with AsyncTask for synchronization