Yes, but that doesn't fix Ed's problem, using the explicit cast just gives a different incorrect result. I had a little play with the code and couldn't get it to work either.
I'm also confused by the problem, and curious to know the solution...
Jamie
indeed the problem is that he is reading a float as int without cast;
but also he is passing an extra argument (the mode method defined with two arguments, but pd expects only a float)