Remove trailing slash when loading env
Improve tests for env loading wrt new lines