Fixed python3 compatibility