More unit test and style fixes