fix permissions and links