fix bug: unintended argument
fix bug: wrong exception arguments
add test