Added Null Checks in script