Fixed viewport checks.

closes #1250