added exception tracking
fixed some bugs