Fix for encoding bug