Merge "Slightly improve error handling"