Fix for bug in the viewport handling