fixed a negative calculation bug in a function argument