fix bug in merge samples