#123 fix possible exceptions