implement and close #341