Fix viewport resize 

It fixes viewport resize issue introduced from 64a376516e316