Fix bug with css guards. Fixes #1750. Fixes #1613. Fixes #1813