Fixed test cases and those errors
fixed a bug that var 'reqs' is defined in if ... end clause only