altered some exception handling