minor bug and style fixes