Fixed a bug 'cannot encode masked'