fix bug in the code with float