ProgressDialog and fixed some errors