The problem was that when I did 0 mastering, j4 axis was not actually in 0. The axis was 180 degrees turnover. This happened because one indicator for 0 position was missing on j4.
I verified the position of j4 to another robot and I remastered the robot in 0. Now works fine. Thank you!