catching the IOException