adding null element handling