Fix Invalid ratio computing