var -> val, some small fixes