fix error when swap percentage is less than 1
updated mools pr into this PR