fix next rec_id calculation for targets selection