added null check to prevent it from crashing