fixing encode