fixed destroy routine