fixed a bug where the percentage was wrong when calculate button was pressed