preserve habit-style max repeaters and include in to_string()

Resolve a bug in the to_string() method where habit-style repeater max values were left out.