Changed the logic for hiding the loader