Fix error handling a bit.