pull fixes for viewport-related code from base