more debugging and fixes