FIX: handle encoding correectly