Fix destination path
Fix bugs
Move url function from env to funcMap
Remove index from env
Clean up global funcMap
Add tests