Fix for Emoji keyboards

Emoji keyboards cause a crash with latest change. This fixes it.