Fixed some nil checks.