fixed the bug o fincorrect calculation