Wasn't doing the correct nil check