Even better error handling

See diff