added hook exception handling