stop the loading indicator at the right time