Improve resource path registration

We cannot rely on $IP for determining path
Merge pull request #20 from wmde/resourcepath

Improve resource path registration