add nonnegativity check