fix a few issues in delete