add auto capture mode and fix bug