added object.valid check to avoid bugsplat