try fix, I hate python's dynamic type

TypeError: 'float' object cannot be interpreted as an integer