Fix recusrion in is_merged() method