add basic exception handling