Fixed the problem with the variable logic