added nil check