Exception handling

Some exception handling changes are done w.r.t Issues 253, 254 and 249. Also changes of Issue 252 - large flow_stats handling is part of this commit.