Small Error handling improvement