add maxtime, fix stop record and set plugin on background thread