Fixing the function to fix precision loss.