Added missed null variable check