modify a bug of 'not deleting all the tables' by changing for loop from i=0, ... to i= array length to 0