Added some nil check