I use the UserRole to save layer id, so I changed this with:
i = self.widget.findData(self.initLayer(), Qt.UserRole)