fix encode with options