minor polishing
better handling of exceptions

relates to #161