Fix some masonry layout bugs when toggling between views.