small change in error handling