fix and cleanup permalink issues