Modified to prevent passing invalid IME geometry to the app