Handle relative paths better (thanks David Engster for the bug report)