fixed serious bug in exception handling, fixed bug in main program, changed test programs such that they work