I think @lolautruche is talking in the direction of just changing this line to also check if defined before checking it is false.