added condition, fixed permalinks