finally fixed the viewport bug