Fixed issue with setvar not working everytime