fix viewport handling