Fix progess bar calculation