Fix object error check