edit method with checking