Small rewrite to error handling in index