Fix error handling in master