error handling for fork