NullReferenceException bugfix for null arguments