Fix a bug when the input is shared