fixed runtime errors, first test about undefined variable