Exception-related enhancements (fix #1)
Add some synchronized (fix #2)