Correctly handle paths with only one segment in hit-testing code.

Closes #430.