fix locking in exec_not_null{,_no_headers}