better solution for encoding fix