refactoring
bugs fixed at let statememt