fixed bugs in variable setting and getting