Fixed crash bug for rules