Handled errors more gracefully