remove some debug output and add some fixes