fix to crash if objects are modified while drawing