FIX: window resizing is now handled corrctly