Decrease serialized rules tree size and minor fixes