Check for proper section before highlighting

Fixes #873