Fix masonry vertical overlap bug by waiting until images are loaded to do masonry layout