fixed missing encode call