This solution fixed my problem.
@Edward_Bordin posted an example code on how to fix the two comments below.