initialize masonry only when necessary