Relative paths are resolved in rules

Fixes #336 plus tests.