Slightly better error handling.