fixed error handling for let/def