fix bug: not substituting global constants