added more destructor stuff for proper memory management, and debugged lua copying stuff