Added some error checks. Added common/hexception.h