Improve extraction of path for #init.

Closes #280.