Bug fix: spacing before headings

To prevent an indention, the command \par is temporarily changed instead of using \@afterindent\@afterheading
Similarly, the code below should have some explanation.