fix logic of activity indicator