Additional nil check and TypeError rescue