checkValid fixed