added a little error handling