Fix test cases and test env var