curl fixes and some debug code