bugfix with null elements in array