Better handling of line search failure