fixed bug when permalink is called