added error propagation in threads