UART reciving data but unstable

Hello everyone,
I am trying to interface a Pi Pico board with PYNQ Z2 board using UART communication at 9600 baud rate. I am successfully receiving data, but after a couple messages, there is byte shifting. The message ‘hello’ is received as ‘elloh’ etc. I am guessing that I am missing an if statement checking if there is serial data available (like on an Arduino).

Here is the code:

from pynq.overlays.base import BaseOverlay
from pynq.lib import MicroblazeLibrary
base = BaseOverlay ('base.bit') 
print ('finish')

lib = MicroblazeLibrary(base.RPI, ['uart']) 
device = lib.uart_open(14,15)

import time

while True:
    buf = bytearray(5)
    device.read(buf, 5)
    print(buf)
    time.sleep(0.5)

And a screenshot of the problem.

My question is how to resolve this bug?

Also, any good repository with hardware examples (SPI, I2C, CAN etc.) is welcome.

Thank you so much for your time!
A. Jevtic

A picture of the setup also: