Fixing potential NPE.
Fixing NPE.