close #542, and some small style fixes