Changed read from uart, now it works correctly