setFlag to have validation