image encoding bug