Fixing potential null reference
was added during previous patch when order of operations changed.