few exceptions and bug fixes