Clean up exception handling and fork logic