Fix var handling
Fix tests