Fixed prevent issue that causes dereference after null check.