Minor adjustment in error handling