Delete api fixed and cleanup function added to test cases.