Bugs fixed in asynchronous db clearing