prevent null elements from causing errors