fixed permaLink logic