Fixed incorrect calculation