minor optimization in instrument.py