catch correct exception
fix pointer containment comparison
add various tests