Fix incorrect transcoding resulting in infinite loop