Math fix for PY2