rename invalid to valid and small fixes