delete record functions; bug fixes