Add let for local variables

In original code, such variables are declared as global variables
and cause byte-compile warnings.