Theoretically fix some bugs