Bug fixes, add destroy function 2