Fix "can't access let declaration before initialization" errors.
Fix "assignment to undeclared variable" error.