fix error and add edit check