Fix decoder bug and add mask disable flag