add some exception protection
add some protection