Added some null check