add more debug logs. fix redonkulously large memory leak. thanks to @andrewkm for alerting me