Added nil checks to prevent crashing in prod.