handle case of error more gracefully