avoid inserting null pointers into index