Fix various issues with comparing Python entity handles.
Fix py_restart causing a crash when using it in a loaded map with Python implemented gamerules.
Fix wrong compare when comparing two handles directly.