code cleanup
better cleanup for child worker