test function. update symbol algorithm. fix bugs on variable lifecycle