fix bug in codec