let(simp) behaves different when loaded from batch file



Dear all,

The code below gives different results when run from the command line or when 
loaded using the 'batch' or 'load' command.
When I run from the command line, the let rule is applied and the result of 
letsimp is '5'. When run from batch, the result is ?%at('diff(f(x),x,1),[x 
=0])

The code below should simplify df(x)/dx to 5 when x=0 

test() := block([expr,F],
  expr : diff(f(x), x),
  F(xx) := at(expr, [x = xx]),
  let(at(diff(f(x),x),[x=0]),5), 
  letsimp(F(0))
)$

Does somebody know what's going wrong here? 

Kind regards,
NB