Small tweaks to error handling stuff