fix an env test, add a util function for errors