fix port version detection and pkg to port dir lookup