Fixed a bug of dismissing progress dialog