correct encoding and recovery