fixing encode error