fixing some errors with auto delete