handle dynamic empty and null arrays