added fail and catch handler, more tests