Fix category labels at edge of boundaries

Closes 377