Issue-832. Fixes after code review.