Fixed substituteExpression etc so they actually work