Few bug fix, better exception management (but still need improvement)