Need to move the unsetting to just before the java call