lots of changes for fork(), need debug