Bug fix of remove duplicate block function