#227 fixed exception handling