Small fixes for Python compatibility