Ensure modifyVars does not call refresh if no variables are specified #1699

See issue #1699.