fixed getting ref variable