add better exception test
add more error-handling support