Fix rule bugs