Moved null check