minor changes in exception handling