Application layer: fix boundaries

Identified and fixed by Thomas, thanks.