fixed possible bug when using enc