Fixed potential null reference exception.