Synced with version 16.4 of bidi package