Fix encoding and fix for destroy method

Fix encoding and fix for destroy method