Fix a bug when unpublishing