fixed loading bar animation (made it conditional)