fixed the valid flag