Sync version with ref python implementation