bugfixes, unref(), etc
fixing a few hang ups