LCD displays malfuncted data

Hi, I bought 2x16 LCD display(arduino compatible) and I wired it like this:

However my connections are a bit different. I don’t have pot here, because I had to go to ground level to see anything anyways, and second thing I have one before last pin connected directly to 5V.

When I don’t have any code uploaded and turn it on, it shows black boxes on top and nothing on bottom, which is proper I guess. Even if I upload simple arduino code to display ‘Hello World’ in first line, everything goes well and readable. But the problem comes when I try to use second line too. Text gets malfuncted and it looks like in image 1. On the image 1 arduino is powered by USB cable, and it looks kinda fine if we skip characters disortion, but on image 2 arduino is powered by 9V baterry, that feeds into Vin pin.

Could this be fault of just one resistor?

This is my display: