fixes percentage calculation