Added error handling to forking iterator