database now working with permalinks