fix broken constraints, resolve var erros