improve code, fix a*b/a=a*a/b bug
Improve code