Add checks for null inputs

Not sure if this is even needed, Sean ??