Repaired loading bar funcitonallity