X error (bad value) when switching to minibuffer