Trying to open Images with jSon Object shows unreliable behavior

I’m not quite sure what B2 is. The App sends signals to a HC-05 Bluetooth Modul and reads and writes via serial communication.

From there, the Arduino sends the jSon object also via serial communication to the GUI (through USB).

The Arduino sends this if no button has been pressed in the App:

{"ArdC":"1","XF":"0","XD":"0","YL":"0","YR":"0","ZU":"0","ZD":"0","Init":"0","Blth":"0","LimR":"0","LimH":"0","LimV":"0","WT":"0"}

If i press the Button UP (in this case the XF, for X-Axis Forward) this string gets sent from Arduino to Processing:

{"ArdC":"1","XF":"1","XD":"0","YL":"0","YR":"0","ZU":"0","ZD":"0","Init":"0","Blth":"0","LimR":"0","LimH":"0","LimV":"0","WT":"0"}

That works fine. It is very reliable and always in Realtime. But the problems occur if I want to process the jSon object. So i.e if I ask: “Is XF == 1”, it jumps into the correct if-case (i know that because i print out a test string on the command window). The strange thing is, that the test string ALWAYS gets printed out, but the image (which is right above the println(“test string”)) DOES NOT always gets shown.

I shortened the Processing code to the minimum:

import processing.serial.*;

String myString = null;
Serial myPort;  // The serial port
PImage imgGreen;
PImage imgRed;
PImage wallpaper;

void setup() {
  fullScreen();
  myPort = new Serial(this, Serial.list()[0], 9600);
  myPort.clear();
  imgGreen = loadImage("greenEggSmall.png");
  imgRed = loadImage("redEggSmall.png");
  wallpaper = loadImage("Wallpaper4.jpg");

  void draw() {
    background(wallpaper);
    while (myPort.available() > 0) {
      String myString = myPort.readStringUntil('}');

      if (myString != null) {
        try {
          JSONObject json = JSONObject.parse(myString);
          String btnXForward = json.getString("XF");

          if ((btnXForward.equals("1")) == true) {
            image(imgGreen, 1030, 665);
          } else {
            image(imgRed, 1030, 665);
          }

          catch (Exception e) {
            println("An error occured, while trying to parse the jSon object.");
          }
        }
      }
    }
  }

Thanks for your help !
Niko