Fixed permalink bugs when the Permalink settings is set to Default.

Closes gh-221