Prevented TypeError where variable was null