Fixing Double encoding bug