Fixed errors arising from Python 3.x

This change makes the render_math plugin compatible with Python 3. It fixes the integer division used for binary search