mem leak
thread leak. fix not ideal