fix vars and functions interaction