fix path resolution, add tests