check for null before applying masonry