added some exception checking